//////////////////////////////////////////////
// File				:	Game.cpp
//
// Author			:	Nick Faletra (NF)
//
// Date Created		:	12/19/2013
//////////////////////////////////////////////
#include "Game.h"

CGame::CGame() : m_pRenderer(nullptr)
{
}

CGame::~CGame()
{
}

void CGame::Initialize(HWND hWnd, HINSTANCE hInstance, int nWidth, int nHeight, bool bWindowed)
{
	m_pRenderer = new CRenderer();
	m_pRenderer->Initialize(hWnd, nWidth, nHeight, bWindowed);

	SetRunning(true);

	m_rBackgroundSize.top = 0;
	m_rBackgroundSize.left = 0;
	m_rBackgroundSize.bottom = nHeight;
	m_rBackgroundSize.right = nWidth;

	m_nScreenWidth = nWidth;
	m_nScreenHeight = nHeight;
	m_bWindowed = bWindowed;
}

void CGame::Shutdown()
{
	if(m_pRenderer)
	{
		m_pRenderer->Shutdown();
		delete m_pRenderer;
		m_pRenderer = nullptr;
	}
}

bool CGame::Main()
{
	m_pRenderer->Clear(0, 0, 255);
	m_pRenderer->DeviceBegin();
	m_pRenderer->SpriteBegin();

	m_pRenderer->SpriteEnd();
	m_pRenderer->DeviceEnd();

	m_pRenderer->Present();

	return GetRunning();
}